package com.niit.mall.product.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.niit.mall.product.domain.dto.ProductDTO;
import com.niit.mall.product.domain.po.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 商品表 Mapper 接口
 * </p>
 *
 * @author ChuXuan
 * @since 2025-05-26
 */
@Mapper
public interface ProductMapper extends BaseMapper<Product> {

    /**
     * 查询商品信息(包括逻辑删除的商品)
     * @param id 商品ID
     * @return 商品信息
     */
    @Select("select brand_id, id, name, category_id, price, stock," +
            "image, spec, sold, comment_count, create_date, isAD, " +
            "creator, updater, update_date, is_deleted, version, " +
            "publish_status, verify_status, product_sn " +
            "from `pardo-product`.tb_product where id = #{id}")
    Product queryByIdLogic(Long id);

    /**
     * 添加商品
     * @param productDTO 商品信息
     */
    void addProduct(ProductDTO productDTO);
}
